- /* factfigs.cpp by K.Tsuru */
- /************************************
- It returns the figures of factorial n! in a decimal system
- by the Stirling's formula.
- *************************************/
- #include <cmath>
- #ifndef DEF_CONST_H
- #include "defconst.h"
- #endif
- unsigned long Stirling(unsigned long n){ // ver. 2.17.1 change into "unsigned long"
- static double C1 = 0.5*log10(2*M_PI) +1.0, C2 = log10(M_E);
- if(n < 4) return 1; // <= 3! = 6
- double N = n, f = C1 - C2*N + (N + 0.5)*log10(N);
- return (unsigned long)f;
- }
factfigs.cpp : last modifiled at 2015/10/23 16:15:58(537 bytes)
created at 2016/04/11 11:17:20
The creation time of this html file is 2017/10/07 10:54:15 (Sat Oct 07 10:54:15 2017).